Skip to content

fix: close Flight sessions before transport#16

Merged
fvaleye merged 5 commits into
mainfrom
fl/close-flight-sessions
Jul 25, 2026
Merged

fix: close Flight sessions before transport#16
fvaleye merged 5 commits into
mainfrom
fl/close-flight-sessions

Conversation

@fvaleye

@fvaleye fvaleye commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Send the standard Flight SQL CloseSession action when closing a client.
  • Verify that the server reports the session as closed.
  • Close the underlying Flight transport even when session cleanup fails.

Closing the PyArrow FlightClient shuts down the transport, but it does not invalidate the server session. Altertable keeps an abandoned session until its four-hour TTL expires. This becomes more costly when dbt uses one session per worker thread.

The client now sends the protocol-defined empty CloseSessionRequest before closing the transport and validates the returned CloseSessionResult. The transport close runs in finally, so a cleanup RPC failure cannot leak the local transport. The original cleanup error still propagates to the caller.

Apache Arrow documents CloseSession as the operation that closes and invalidates the current session context: https://arrow.apache.org/docs/format/FlightSql.html#flight-server-session-management

@fvaleye
fvaleye force-pushed the fl/close-flight-sessions branch from b625384 to d654a74 Compare July 24, 2026 15:13
@fvaleye
fvaleye force-pushed the fl/close-flight-sessions branch from dfd5773 to 4b27286 Compare July 25, 2026 18:46
@fvaleye
fvaleye merged commit 2625d44 into main Jul 25, 2026
6 checks passed
@fvaleye
fvaleye deleted the fl/close-flight-sessions branch July 25, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants